package com.azxcrm.project.system.basic.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.azxcrm.common.utils.StringUtils;
import com.azxcrm.project.system.basic.dao.ICustomerModifyRecordDao;
import com.azxcrm.project.system.basic.domain.CustomerModifyRecord;

/**
 * 客户更改记录 服务层实现
 * 
 * @author Dustyone
 * @date 2018-09-13
 */
@Service
public class CustomerModifyRecordServiceImpl implements ICustomerModifyRecordService {
	@Autowired
	private ICustomerModifyRecordDao customerModifyRecordDao;

	/**
	 * 查询客户更改记录信息
	 * 
	 * @param recordId
	 *            客户更改记录ID
	 * @return 客户更改记录信息
	 */
	@Override
	public CustomerModifyRecord selectCustomerModifyRecordById(Integer recordId) {
		return customerModifyRecordDao.selectCustomerModifyRecordById(recordId);
	}

	/**
	 * 查询客户更改记录信息
	 * 
	 * @param recordId
	 *            客户更改记录ID
	 * @return 客户更改记录信息
	 */
	@Override
	public List<CustomerModifyRecord> selectCustomerModifyRecordByCustomerId(Integer customerId) {
		return customerModifyRecordDao.selectCustomerModifyRecordByCustomerId(customerId);
	}

	/**
	 * 查询客户更改记录列表
	 * 
	 * @param customerModifyRecord
	 *            客户更改记录信息
	 * @return 客户更改记录集合
	 */
	@Override
	public List<CustomerModifyRecord> selectCustomerModifyRecordList(CustomerModifyRecord customerModifyRecord) {
		return customerModifyRecordDao.selectCustomerModifyRecordList(customerModifyRecord);
	}

	/**
	 * 新增客户更改记录
	 * 
	 * @param customerModifyRecord
	 *            客户更改记录信息
	 * @return 结果
	 */
	@Override
	public int insertCustomerModifyRecord(CustomerModifyRecord customerModifyRecord) {
		return customerModifyRecordDao.insertCustomerModifyRecord(customerModifyRecord);
	}

	/**
	 * 修改客户更改记录
	 * 
	 * @param customerModifyRecord
	 *            客户更改记录信息
	 * @return 结果
	 */
	@Override
	public int updateCustomerModifyRecord(CustomerModifyRecord customerModifyRecord) {
		return customerModifyRecordDao.updateCustomerModifyRecord(customerModifyRecord);
	}

	/**
	 * 保存客户更改记录
	 * 
	 * @param customerModifyRecord
	 *            客户更改记录信息
	 * @return 结果
	 */
	@Override
	public int saveCustomerModifyRecord(CustomerModifyRecord customerModifyRecord) {
		Integer recordId = customerModifyRecord.getRecordId();
		int rows = 0;
		if (StringUtils.isNotNull(recordId)) {
			rows = customerModifyRecordDao.updateCustomerModifyRecord(customerModifyRecord);
		} else {
			rows = customerModifyRecordDao.insertCustomerModifyRecord(customerModifyRecord);
		}
		return rows;
	}

	/**
	 * 删除客户更改记录信息
	 * 
	 * @param recordId
	 *            客户更改记录ID
	 * @return 结果
	 */
	@Override
	public int deleteCustomerModifyRecordById(Integer recordId) {
		return customerModifyRecordDao.deleteCustomerModifyRecordById(recordId);
	}

	/**
	 * 批量删除客户更改记录对象
	 * 
	 * @param recordIds
	 *            需要删除的数据ID
	 * @return 结果
	 */
	@Override
	public int batchDeleteCustomerModifyRecord(Integer[] recordIds) {
		return customerModifyRecordDao.batchDeleteCustomerModifyRecord(recordIds);
	}

}